package com.zlict.admin.service.impl;

import com.zlict.admin.domain.ProjectAcceptance;
import com.zlict.admin.mapper.ProjectAcceptanceMapper;
import com.zlict.admin.service.IProjectAcceptanceService;
import com.zlict.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

import static com.zlict.common.utils.SecurityUtils.getUserId;

/**
 * 项目验收Service业务层处理
 * 
 * @author dzw
 * @date 2025-06-11
 */
@Service
public class ProjectAcceptanceServiceImpl implements IProjectAcceptanceService 
{
    @Autowired
    private ProjectAcceptanceMapper projectAcceptanceMapper;

    /**
     * 查询项目验收
     * 
     * @param id 项目验收主键
     * @return 项目验收
     */
    @Override
    public ProjectAcceptance selectProjectAcceptanceById(Long id)
    {
        return projectAcceptanceMapper.selectProjectAcceptanceById(id);
    }

    /**
     * 查询项目验收列表
     * 
     * @param projectAcceptance 项目验收
     * @return 项目验收
     */
    @Override
    public List<ProjectAcceptance> selectProjectAcceptanceList(ProjectAcceptance projectAcceptance)
    {
        return projectAcceptanceMapper.selectProjectAcceptanceList(projectAcceptance);
    }

    /**
     * 新增项目验收
     * 
     * @param projectAcceptance 项目验收
     * @return 结果
     */
    @Override
    public int insertProjectAcceptance(ProjectAcceptance projectAcceptance)
    {
        projectAcceptance.setCreateTime(DateUtils.getNowDate());
        projectAcceptance.setCreateBy(getUserId());
        return projectAcceptanceMapper.insertProjectAcceptance(projectAcceptance);
    }

    /**
     * 修改项目验收
     * 
     * @param projectAcceptance 项目验收
     * @return 结果
     */
    @Override
    public int updateProjectAcceptance(ProjectAcceptance projectAcceptance)
    {
        projectAcceptance.setUpdateBy(getUserId());
        projectAcceptance.setUpdateTime(DateUtils.getNowDate());
        return projectAcceptanceMapper.updateProjectAcceptance(projectAcceptance);
    }

    /**
     * 批量删除项目验收
     * 
     * @param ids 需要删除的项目验收主键
     * @return 结果
     */
    @Override
    public int deleteProjectAcceptanceByIds(Long[] ids)
    {
        return projectAcceptanceMapper.deleteProjectAcceptanceByIds(ids);
    }

    /**
     * 删除项目验收信息
     * 
     * @param id 项目验收主键
     * @return 结果
     */
    @Override
    public int deleteProjectAcceptanceById(Long id)
    {
        return projectAcceptanceMapper.deleteProjectAcceptanceById(id);
    }
}
